package com.cy.pj.goods.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.cy.pj.goods.pojo.Goods;

@Mapper
public interface GoodsDao {
	
	/**查询全部数据*/
	@Select("select * from tb_goods")
	List<Goods> findAll();
	
	/**根据id删除数据 */
	@Delete("delete from tb_goods where id=#{id}")
	int deleteById(Integer id);
	
	/**添加数据*/
	@Insert("insert into tb_goods(name,remark,createdTime) values (#{name},#{remark},#{createdTime})")
	int saveGoods(Goods goods);
	 
	 /**修改数据*/
	  @Update("update tb_goods set name=#{name},remark=#{remark} where id=#{id}")
	  int updateGoods(Goods goods);
	  /**基于商品id查询商品信息*/
	 @Select("select * from tb_goods where id=#{id}")
	 Goods findById(Integer id);
}
